home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-11
/
pdrd2.zip
/
RD.ZIP
/
RD_DEMO4.PRG
< prev
next >
Wrap
Text File
|
1993-01-11
|
3KB
|
77 lines
/*
RD_DEMO4.PRG
Demonstrates the use of the following APIs:
1. ADr_keys() - defines hot keys and a hot key handler.
2. ADr_exit() - defines an Exit Block to validate the Read, when
attempting to exit.
3. ADr_filled() - checks if specified Gets have been filled with data.
4. ADr_blank() - blanks or empties specified Gets.
*/
#include "read.ch"
#include "inkey.ch"
//---------
func main()
local getlist[0]
local cShort := "Short string"
local cLong := "This is a very long string. It is '@S PICTUREd'. This is the last of three sentences."
local nNumber := 9
local lLogical := .t.
local dDate := date()
local aArray := { "Frankie", "Library" }
local nT := 0, nL := 10, nB := 8, nR := 50
local cColor := setcolor( if( iscolor(), "W+/BG, GR+/R,,, N/R", nil ) )
local aScn, aScn2
local bConfig := {|e| ADr_keys( e, { K_F7, K_F8, K_F9, K_F10 },;
{|e,nth,nkey|Xkeys4(e,nth,nkey)};
),;
ADr_exit( e, {|e| ADr_filled( e,;
{ 1, 2, 5 },;
{|| ADmessage({ "Fields 1, 2, and 5 may not be left blank"})};
);
};
);
}
cls
aScn = ADbox( nT, nL, nB, nR )
@nT+1, nL+2 say "Short String" adget cShort
@nT+2, nL+2 say "Long String " adget cLong picture "@S24"
@nT+3, nL+2 say "Numeric " adget nNumber
@nT+4, nL+2 say "Logical " adget lLogical
@nT+5, nL+2 say "Date " adget dDate
@nT+6, nL+2 say "Array Elem1 " adget aArray[1]
@nT+7, nL+2 say "Array Elem2 " adget aArray[2]
aScn2 = ADmessage( { "The following are hot keys:",;
" F7 - blanks the current Get",;
" F8 - blanks Get #2",;
" F9 - blanks Get #s 6 and 7",;
" F10 - blanks all Gets",;
"",;
"The Read will not be saved if any of Get #s 1, 2, or 5",;
"is empty";
}, 13,, .f., .f. )
ADread( getlist, bConfig )
ADrestscn( aScn )
ADrestscn( aScn2 )
setcolor( cColor )
return nil
//-----------------------
func Xkeys4(e, nth, nkey )
if nth = 1
ADr_blank( e )
elseif nth = 2
ADr_blank( e, 2 )
elseif nth = 3
ADr_blank( e, { 6, 7 } )
elseif nth = 4
ADr_blank( e, {} )
endif
return nil